def call(Map config) {
    log.info("代码构建")
    def buildVersion = " "
        //if(!stageCondition.masterCondition(BRANCH_NAME,params.buildRecordId)){
        //    return
        //}
        projectpom = readMavenPom file: 'pom.xml'
        projectArtifactId = projectpom.getArtifactId()
        //PR分支java构建
        if(BRANCH_NAME.startsWith('PR-')){
            env.PREVIEW_VERSION = "0.0.0-SNAPSHOT-$BRANCH_NAME"

            container('maven') {
                sh "mvn versions:set -DnewVersion=$PREVIEW_VERSION"
                sh "mvn clean package -Dmaven.test.skip=${config.build.skip_test}"
            }

        }else if(BRANCH_NAME.startsWith('master')){
            container('maven') {
                sh "git checkout $BRANCH_NAME"
                sh "git config --global credential.helper store"

                sh "jx step git credentials"
                // so we can retrieve the version in later steps
                sh "echo \$(jx-release-version) > VERSION"
                sh "mvn versions:set -DnewVersion=\$(cat VERSION)"
                //sh "ls -l"
                sh "rm -fr Makefile && cp k8sconfig/javaMakefile/Makefile ."
                //sh "ls -l"
                sh "export FILE_NAME=$projectArtifactId &&  make tag"

                //正式版本发布相关的jar到私有maven仓库
                sh "mvn clean source:jar deploy -Dmaven.test.skip=${config.build.skip_test} -DaltDeploymentRepository=local-nexus::default::http://nexus.goldgov.com/nexus/content/repositories/releases/"

                env.PREVIEW_VERSION = sh(returnStdout: true, script: "cat ./VERSION").trim()

                //copy 相关的jar文件，并去掉doc.jar和source.jar文件
                //sh "cp webapp/target/*.jar k8sconfig/dockerfile && rm -fr k8sconfig/dockerfile/*-javadoc.jar && rm -fr k8sconfig/dockerfile/*-sources.jar"
                //dir ('./k8sconfig') {
                //    sh "export VERSION=`cat ../VERSION` && skaffold build -f skaffold.yaml"
                //}

//            utilities.build_java_image("$PREVIEW_VERSION",config.deploy_aliyun)


//            if(params.deploy_aliyun){
//                sh "export VERSION=`cat VERSION` && docker tag $DOCKER_REGISTRY/$ORG/$projectArtifactId:$VERSION $DOCKER_REGISTRY_ALIYUN/kms/$projectArtifactId:$VERSION"
//                sh "export VERSION=`cat VERSION` && docker push $DOCKER_REGISTRY_ALIYUN/kms/$projectArtifactId:$VERSION"
//            }
                //获取发布版本
                buildVersion = readFile encoding: 'Base64', file: 'VERSION'
                //}
            }
        }
    return buildVersion
}